'use strict'

class fans{
    constructor(){
            
        this.param = '/'
     
    }

    async get(c){
        let a = c.service.fun;
        c.setHeader('content-type', 'text/html; charset=utf-8');
        
        let {user_id} = c.query;

        
        let data1 = await a.sel('follow_list',{'followed_id':`${user_id}`},['follow_id'],c.service.pool);
        
        let data = [];
        
        for (var i=0;i<data1.rows.length;i++){
            
            let aa = await a.sel('user_list',{'user_id':`${data1.rows[i].follow_id}`},['user_head','user_name','user_self','user_id'],c.service.pool);
            
            let {user_head,user_name,user_self,user_id} = aa.rows[0];
            data.push({user_head,user_name,user_self,user_id});
        }
        
        c.send({
            type:'array',
            data:data
        })
        


    }
}

module.exports = fans
